<template>
  <work-template v-model="ruleForm"
                 v-loading="loading"
                 :flowId="flowId"
                 @closeSelectedTag="closeSelectedTag" :butShow="false">
    <div slot="form" class="container-div">
      <new-application-info state="readonly" v-model="ruleForm" :status="22"/>
    </div>

  </work-template>
</template>

<script>
import * as apis from '@/api/vehicleDisposal/routineApplyFor.js'

export default {
  name: 'RoutineApplyForDetails',
  components: {
    newApplicationInfo: () => import("../../components/routineDisposal/routineApplyFor/newApplicationInfo.vue"),
  },
  computed: {
    flowId() {
      return this.$route.query?.flowId
    }
  },
  watch: {},
  data() {
    return {
      ruleForm: {},
      loading: false
    };
  },
  created() {
    this.handleDetail()
  },
  mounted() {
  },
  methods: {
    async handleDetail() {
      this.loading = true
      try {
        const res = await apis.vehicleDisposalDetails(this.$route.query.id)
        this.ruleForm = res.data
      } catch (e) {
        console.error(e)
      } finally {
        this.loading = false
      }
    },

    closeSelectedTag() {
      let path = ''
      if (this.$route.query.path === 'RoutineForewarningList') {
        path = '/VehicleDisposal/RoutineDisposal/RoutineForewarningList'
      }
      if (this.$route.query.path === 'RoutineApplyForList') {
        path = '/VehicleDisposal/RoutineDisposal/RoutineApplyForList'
      }
      this.$tab.closePage().then(({visitedViews}) => {
        this.$router.push({
          path: path,
        });
      });
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/styles/cwgd/container.scss";
</style>


